using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace BootyBay.Models.Mapping
{
    public class ApplicationProcessorArchitectureMap : EntityTypeConfiguration<ApplicationProcessorArchitecture>
    {
        public ApplicationProcessorArchitectureMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.PackageLocationUrl)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.PackageCertLocationUrl)
                .IsRequired()
                .HasMaxLength(500);

            // Table & Column Mappings
            this.ToTable("ApplicationProcessorArchitecture");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Id_ApplicationVersionInfo).HasColumnName("Id_ApplicationVersionInfo");
            this.Property(t => t.ProcessorArchitecture).HasColumnName("ProcessorArchitecture");
            this.Property(t => t.PackageLocationUrl).HasColumnName("PackageLocationUrl");
            this.Property(t => t.PackageCertLocationUrl).HasColumnName("PackageCertLocationUrl");
            this.Property(t => t.UploadDate).HasColumnName("UploadDate");

            // Relationships
            this.HasRequired(t => t.ApplicationVersionInfo)
                .WithMany(t => t.ApplicationProcessorArchitectures)
                .HasForeignKey(d => d.Id_ApplicationVersionInfo);

        }
    }
}
